package com.atguigu.gmallpublisher1.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ProductStatsMapper {

    //返回值最简单的格式:单行单列
    @Select("select sum(order_amount) from dws_user_province_sku_10s where toYYYYMMDD(stt)=#{date}")
    BigDecimal selectGmv(int date);

    //返回值最复杂的格式:多行多列
    //List[
    // Map[(tm_id->8),(tm_name->索芙特),(order_amount->11642.90)],
    // Map[(tm_id->5),(tm_name->小米),(order_amount->125560.00)],
    // ...
    // ]
    @Select("select tm_id,tm_name,sum(order_amount) order_amount from dws_user_province_sku_10s where toYYYYMMDD(stt)=#{date} group by tm_id,tm_name order by order_amount desc limit #{limit}")
    List<Map> selectGmvByTrademark(@Param("date") int date, @Param("limit") int limit);


}
